package com.jzo2o.api.market;

import com.jzo2o.api.market.dto.request.CouponUseBackReqDTO;
import com.jzo2o.api.market.dto.request.CouponUseReqDTO;
import com.jzo2o.api.market.dto.response.AvailableCouponsResDTO;
import com.jzo2o.api.market.dto.response.CouponUseResDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;

/**
 * 内部接口 - 优惠卷相关接口
 *
 * @author Zhy
 * @version 1.0
 * @date 2025-04-11 9:25
 */
@FeignClient(contextId = "jzo2o-market", value = "jzo2o-market", path = "/market/inner/coupon")
public interface CouponApi {

	@GetMapping("/getAvailable")
	List<AvailableCouponsResDTO> getAvailable(@RequestParam("totalAmount") BigDecimal totalAmount);

	/**
	 * 优惠券使用，并返回优惠金额
	 *
	 * @param couponUseReqDTO 优惠券使用请求参数
	 */
	@PostMapping("/use")
	CouponUseResDTO use(@RequestBody CouponUseReqDTO couponUseReqDTO);

	/**
	 * 优惠券退款回退
	 */
	@PostMapping("/useBack")
	void useBack(@RequestBody CouponUseBackReqDTO couponUseBackReqDTO);

}
